package zhenbang
{

	import flash.display.*;
	import flash.events.*;

	public class DateEditor extends Sprite
	{
		private var completeFunc:Function;
		private var date:String;
		//向endFunc中传 
		public function DateEditor(date:String="2017-8-27",endFunc:Function=null)
		{
			completeFunc = endFunc;
			this.date= date;

			date_edit = new LunarSelect(date);
			date_edit.addEventListener(Event.COMPLETE,date_edited);
			date_edit.addEventListener(FocusEvent.FOCUS_IN,focusIn);
			addChild(date_edit);
		}

		private function focusIn(e:Event):void
		{
			if(parent)
				parent.addChild(this);
		}

		private var date_edit:LunarSelect;

		private function date_edited(e:Event=null):void
		{
			if(completeFunc!=null)
				completeFunc(date_edit.date_value);
		}
		public function get value():Array
		{
			return date_edit.date_value;
		}
	}
}
